using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Mean.Net
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            decimal blah = 0;
            string theNumber;

            if(txtNumToAdd.Text.Length < 1)
            {
                txtNumToAdd.Text = "0";

            }

            if (txtDecimal.Text.Length < 1)
            {
                txtDecimal.Text = "0";

            }
            theNumber = txtNumToAdd.Text + "." + txtDecimal.Text;
            lstGrades.Items.Add(theNumber);

            for (int i = 0; i < lstGrades.Items.Count; i++)
            {
                lstGrades.SetSelected(i, true);
                blah = blah + Convert.ToDecimal(lstGrades.Text);

            }
            txtCurrent.Text = Convert.ToString(blah / lstGrades.Items.Count);
            txtNumToAdd.Clear();
            txtDecimal.Clear();
            txtNumToAdd.Focus();
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            lstGrades.Items.Clear();
            txtDecimal.Clear();
            txtCurrent.Clear();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            txtNumToAdd.Focus();

        }

        private void btnPercentFinder_Click(object sender, EventArgs e)
        {
            frmPercentFinder PercentForm = new frmPercentFinder();
            PercentForm.Visible = true;
        }

    }
}